package cn.pegasus.teamwork.appinterface.controller.project;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.pegasus.teamwork.appinterface.base.BaseController;
import cn.pegasus.teamwork.appinterface.util.ParameterEunm;
import cn.pegasus.teamwork.appinterface.util.ReturnRsUtils;
import cn.pegasus.teamwork.pegasus.entity.BussServiceProject;
import cn.pegasus.teamwork.pegasus.service.BussServiceProjectService;

/**
 * @ClassName: SysUcenerUserController
 * @Description: 用户控制中心
 * @author ryan.bian
 * @date 2017年11月12日 上午10:10:32
 * 
 *       包括以下主要几个接口：
 * 
 *       1.用户注册 2.用户登录 3.用户第三方接口登录 3.用户修改资料 4.用户手机校验（是否存在唯一性） 5.用户密码修改
 *       6.用户支付密码修改 7.用户退出
 * 
 * 
 */
@CrossOrigin(origins = "*", maxAge = 3600)
@Controller
@RequestMapping("/pro/*")
public class ProjectInfoController extends BaseController {

	private static final Logger LOGGER = LoggerFactory.getLogger(ProjectInfoController.class);

	@Autowired
	private BussServiceProjectService projectService;

	/**
	 * 用户查询项目列表
	 * 
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/gpl", method = RequestMethod.POST)
	public Map<String, Object> getProjectList(HttpServletRequest request, HttpServletResponse respons,
			@RequestParam Map<String, Object> map) {
		Map<String, Object> resultMap = new HashMap<String, Object>();
		try {
			map.put("classicStatus", 0);
			List<BussServiceProject> lis = projectService.query(map);
			
			if (lis != null && lis.size() > 0) {
				Map<String, Object> mape = new HashMap<String, Object>();
            	mape.put("lis", lis);
				resultMap =  ReturnRsUtils.resultBackString(ParameterEunm.SUCCESSFUL_CODE,mape);
			} else {
				resultMap =  ReturnRsUtils.resultBackString(ParameterEunm.ERROR_NULL_RESULT_CODE,null);
			}
		} catch (Exception e) {
			LOGGER.debug("执行查询项目列表方法错误");
			resultMap =  ReturnRsUtils.resultBackString(ParameterEunm.FAILED_CODE,null);
		}
		return resultMap;
	}

	public static void main(String[] args) {
		float  a = 100;
		float  b = 99;
		System.out.println(b/a);
//		System.out.println(99/2);
	}
	
}
